using System;
using CPlatePrintSys.Domain.DTOs;

namespace CPlatePrintSys.Domain.Models
{
    /// <summary>
    /// PlateAnnotationInfo工厂/转换器
    /// </summary>
    public static class PlateAnnotationInfoFactory
    {
        public static PlateAnnotationInfo FromKmacsDto(KmacsProcessInfoDto dto)
        {
            return new PlateAnnotationInfo
            {
                StreamShipNo = dto.StreamShipNo,
                LotNo = dto.LotNo,
                Sequence = dto.Sequence,
                SheetConsistentNo = dto.SheetConsistentNo,
                CNO = dto.CNO,
                MergedInfo = dto.MergedInfo,
                SheetSpecCls = dto.SheetSpecCls,
                SheetSpecThickness = dto.SheetSpecThickness,
                SheetSpecLength = dto.SheetSpecLength,
                SheetSpecWidth = dto.SheetSpecWidth,
                PlanUsedDate = dto.PlanUsedDate,
                SourceType = SourceType.KMACS
            };
        }

        public static PlateAnnotationInfo FromAmDto(AmDrawingInfoDto dto)
        {
            return new PlateAnnotationInfo
            {
                StreamShipNo = dto.ShipNo,
                LotNo = dto.LotNo,
                PlateNo = dto.PlateNo,
                Sequence = dto.Sequence,
                CNO = dto.CNO,
                LayoutMean = dto.MFlag == 1 ? LayoutMean.MirrorLayout : LayoutMean.Unprocessed,
                DesignSpecCls = dto.DesignSpecCls,
                DesignSpecThickness = dto.DesignSpecThickness,
                DesignSpecLength = dto.DesignSpecLength,
                DesignSpecWidth = dto.DesignSpecWidth,
                DesignDrawingPath = dto.SdbPath,
                SourceType = SourceType.AM
            };
        }

        public static PlateAnnotationInfo FromCadWinDto(CadWinDrawingInfoDto dto)
        {
            return new PlateAnnotationInfo
            {
                StreamShipNo = dto.ShipNo,
                LotNo = dto.LotNo,
                PlateNo = dto.PlateNo,
                Sequence = dto.Sequence,
                DesignSpecCls = dto.DesignSpecCls,
                DesignSpecThickness = dto.DesignSpecThickness,
                DesignSpecLength = dto.DesignSpecLength,
                DesignSpecWidth = dto.DesignSpecWidth,
                DesignDrawingPath = dto.DxfPath,
                SourceType = SourceType.CadWin
            };
        }
    }
} 